import {request} from "@/utils/requestMap";

//获取定位信息
export function getMapLocation() {
	return request({
		url: "/map/ws/location/v1/ip",
		params: {
			ip: '111.206.145.41',
			key: 'R3DBZ-LNRCJ-VCOFN-KBHVB-SRFZZ-HFF62'
		}
	})
}

// 本接口提供由经纬度到文字地址及相关位置信息的转换能力，广泛应用于物流、出行、O2O、社交等场景。
// 匿地址解析

// https://apis.map.qq.com/ws/geocoder/v1/?location=39.984154,116.307490&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77&get_poi=1
export function getLocation(lat, lng, key) {
	return request({
		url: "/map/ws/geocoder/v1/?location=" + lat + ',' + lng + '&key=' + key + '&poi_options=address_format=short;radius=5000;policy=2',
		params: {
			get_poi: 1
		}
	})
}

// https://apis.map.qq.com/ws/place/v1/explore
export function geExplore(data) {
	return request({
		url: '/map/ws/place/v1/explore?boundary=nearby(' + data.boundary + ')',
		params: {
			key: data.key,
		}
	})
}

// 搜索提示
// https://apis.map.qq.com/ws/place/v1/suggestion
export function getSuggestion(data) {
	return request({
		url: '/map/ws/place/v1/suggestion',
		params: {
			key: 'R3DBZ-LNRCJ-VCOFN-KBHVB-SRFZZ-HFF62',
			keyword: data
		}
	})
}


export default {
	getMapLocation
}
